package cz.muni.fi.pv168.realestate;

import java.util.List;

/**
 * PropertyManager interface
 * 
 * @author morty
 *
 */
public interface PropertyManager {

	/**
	 * Stores new property into database. Id for new property is automatically 
	 * generated and stored into id attribute
	 * 
	 * @param property	property to be created
	 * @throws IllegalArgumentException when property is null or if property has 
	 * already assigned id
	 * @throws ServiceFailureException when db operation fails
	 * 
	 */
	void createProperty(Property property) throws ServiceFailureException;
	
	/**
	 * Deletes property from database
	 * 
	 * @param property property to be deleted
	 * @throws IllegalArgumentException when property is null or if property has 
	 * already assigned id
	 * @throws ServiceFailureException when db operation fails
	 */
	void deleteProperty(Property property) throws ServiceFailureException;
	
	/**
	 * Updates property in database
	 * 
	 * @param property to be updated
	 * @throws IllegalArgumentException when property is null or if property has 
	 * already assigned id
	 * @throws ServiceFailureException when db operation fails
	 */
	void updateProperty(Property property) throws ServiceFailureException;
	
	/**
	 * Returns property with given id
	 * 
	 * @param id primary key of requested property
	 * @return property with given id or null if property does not exist
	 * @throws IllegalArgumentException when given id is null
	 * @throws ServiceFailureException when db operation fails
	 */
	Property findPropertyById(Long id) throws ServiceFailureException;
	
	/**
	 * Returns list of all properties in database
	 * @return list of all properties in database
	 * @throws ServiceFailureException when db operation fails
	 */
	List<Property> findAllProperties() throws ServiceFailureException;
}
